package sword;

import java.util.HashSet;
import java.util.Set;

/**
 * @Author: 海琳琦
 * @Date: 2022/5/28 22:15
 * https://leetcode.cn/problems/bu-ke-pai-zhong-de-shun-zi-lcof/
 */
public class Title61 {

    public boolean isStraight(int[] nums) {
        Set<Integer> hash = new HashSet<>();
        int min = 14;
        int max = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == 0) {
                continue;
            }
            //重复直接返回false
            if (!hash.add(nums[i])) {
                return false;
            }
            min = Math.min(min, nums[i]);
            max = Math.max(max, nums[i]);
        }
        return max - min < 5;
    }

    public static void main(String[] args) {

    }
}
